package com.aglhz.nature.view;

import com.aglhz.nature.R;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class OriginShowActivity extends Activity{

	private WebView webView;
	private String url;
	@Override
	protected void onCreate(Bundle savedInstanceState) {	
		super.onCreate(savedInstanceState);
		setContentView(R.layout.originshow);
		webView=(WebView) findViewById(R.id.webView);
		Intent intent=getIntent();
		url = intent.getStringExtra("ORIGIN");
		
			
		WebSettings webSettings = webView.getSettings();  
	    //设置WebView属性，能够执行Javascript脚本    
	    webSettings.setJavaScriptEnabled(true);    
	    //设置可以访问文件  
	    webSettings.setAllowFileAccess(true);  
	  //webview自适应屏幕
	    webSettings.setUseWideViewPort(true); 
	    webSettings.setLoadWithOverviewMode(true); 

	    webView.loadUrl(url);    
	    //设置Web视图  
	   
	    webView.setWebViewClient(new WebViewClient(){
	        @Override
	        public boolean shouldOverrideUrlLoading(WebView view, String url) {
	            view.loadUrl(url);
	            return true;
	        }
	       
	        @Override
	        public void onPageStarted(WebView view, String url, Bitmap favicon) {
	        	
	        	super.onPageStarted(view, url, favicon);
	     
	        
	    	
	        }
	        
	        @Override
			public void onPageFinished(WebView view, String url) {
				
				super.onPageFinished(view, url);
				

			}
	    });
	 

	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if ((keyCode == KeyEvent.KEYCODE_BACK) &&  webView.canGoBack()) {
			webView.goBack();
			 return true;
			}else{
				finish();
			}
			return super.onKeyDown(keyCode, event);
		}
}
